//
//  ComposeTextView.swift
//  CJPWB
//
//  Created by 陈锦彭 on 16/3/21.
//  Copyright © 2016年 chenjinpeng. All rights reserved.
//

import UIKit

class ComposeTextView: UITextView {
    lazy var placeholderLabel : UILabel = UILabel()
    
     // MARK: - 从xib中加载完来到这个函数
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        //添加一个占位label
        setupPlaceholderString()
       
    }

}


// MARK: - 设置UI相关
extension ComposeTextView {
     ///添加一个占位label
    private func setupPlaceholderString() {
        
        addSubview(placeholderLabel)
        placeholderLabel.text = "分享新鲜事....."
        placeholderLabel.textColor = UIColor.lightGrayColor()
        placeholderLabel.frame = CGRect(x: 10, y: 10, width: screenW, height: 10)
        self.textContainerInset = UIEdgeInsetsMake(6, 10, 6, 10)
        
    }

}